package com.taru.order.service;

import com.taru.order.dao.CommentDaoimpl;
import com.taru.order.dao.UserDaoimpl;
import com.taru.order.entity.Articl;
import com.taru.order.entity.Comment;
import com.taru.order.util.ListToTree;

import java.util.List;

public class CommentService {
    /**
     * 评论文章
     * @param comment
     * @return
     */
    public int commentArticl(Comment comment){
        CommentDaoimpl commentDaoimpl=new CommentDaoimpl();
        int isn=commentDaoimpl.commentArticl(comment);
        return isn;
    }
    /**
     * 回复评论
     * @param comment
     * @return
     */
    public int replayComment(Comment comment){
        CommentDaoimpl commentDaoimpl=new CommentDaoimpl();
        int isn=commentDaoimpl.replyComment(comment);
        return isn;
    }
    /**
     * 查询文章评论
     */
    public List<Comment> selectComment(String articl_id){
       CommentDaoimpl commentDaoimpl=new CommentDaoimpl();
        List<Comment> comment=commentDaoimpl.selectComment(articl_id);
        System.out.println(comment);
        List<Comment> commentList=ListToTree.initTree(comment,"0");
        System.out.println(commentList);
        return commentList;
    }
    /**
     * 查询评论回复
     */
    /*public List<Comment> selectReplay(String comment_id){
        CommentDaoimpl commentDaoimpl=new CommentDaoimpl();
        List<Comment> comment=commentDaoimpl.selectReplay(comment_id);
        return comment;
    }*/

}
